Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update reva and refactor config #657

Merged
merged 26 commits into from
Oct 21, 2020
Merged

Conversation

butonic
Copy link
Member

@butonic butonic commented Oct 6, 2020

this pr tries to clarify the storage provider setup and configuration for the ocis storage extension

but how did resolving users in the docker container with id einstein ever work ... 🤔 ... because we were not checking the credentials in glauth ... or accounts?? ... 🤪

IN any case I think we need to tell eos to use the LDAP_BINDDN and LDAP_BINDBW that match the accounts service user ... 95cb8724-03b2-11eb-a0a6-c33ef8ef53ad and we should probably configure it by default ... currently it is empty...

AFAICT this is good on its own but other wheels need fixing ...

@update-docs
Copy link

update-docs bot commented Oct 6, 2020

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes.

@butonic
Copy link
Member Author

butonic commented Oct 6, 2020

Interesting, the tests fail because of permissions errors:

2020-10-06T14:39:50Z ERR srv/app/pkg/mod/github.com/cs3org/reva@v1.2.2-0.20201006093611-4a9be347ac29/internal/grpc/services/storageprovider/storageprovider.go:399 > permission denied error="error: permission denied: root/accounts" 

@butonic
Copy link
Member Author

butonic commented Oct 6, 2020

root/accounts is of the form nodeid:basename so the accounts dir is probably not owned by the user that tries to access the accounts folder in the root of the storage. It is configured to use the ocis driver...

@butonic
Copy link
Member Author

butonic commented Oct 6, 2020

  • log which user ID is trying to access the folder

@butonic
Copy link
Member Author

butonic commented Oct 6, 2020

The problem is that the ocis driver checks the permissions. While the user is provided by the accounts service the root:accounts node ... Has no owner... It has not even been created... So we need a way to create the folder... Or tell the ocis storage driver who owns the storage... Hmmm

@butonic
Copy link
Member Author

butonic commented Oct 6, 2020

Even if we add a config option for the owner... We still need to create the accounts dir. Or is the accounts service trying to create the folder if it does not exist? @IljaN @refs @kulmann

@butonic
Copy link
Member Author

butonic commented Oct 6, 2020

Cool, it does:

func (r CS3Repo) makeRootDirIfNotExist(ctx context.Context, folder string) error {

@butonic
Copy link
Member Author

butonic commented Oct 6, 2020

We could add a config option for the owner. I would prefer that over having a storage that can be added by anyone.

But having a single user ID as the owner limits access to a single user... Which means we would have to share the credentials of that user with all services that want to use the metadata storage.

We could use a map with /path -> owner ID mapping

It could be used to set the owner if a node has no owner set. Which still does not work for root. The storage could precreate these paths when it is initialized and set the owner.

The map would be similar to the storage registry rules...

@butonic
Copy link
Member Author

butonic commented Oct 6, 2020

hm, the account service is also trying to create accounts. but it fails:

2020-10-06T21:43:37+02:00 INF access token is already provided pkg=rhttp service=storage traceid=a05d4064c45adf0501fc17224928ef23
2020-10-06T21:43:37+02:00 DBG http routing: head=data tail=/accounts/4c510ada-c86b-4815-8820-42cdf82c3d51 svc=data pkg=rhttp service=storage
2020-10-06T21:43:37+02:00 DBG NodeFromPath() fn=/accounts/4c510ada-c86b-4815-8820-42cdf82c3d51 pkg=rhttp service=storage traceid=a05d4064c45adf0501fc17224928ef23
2020-10-06T21:43:37+02:00 DBG NodeFromPath() walk node={"Exists":true,"ID":"69afd7ba-55f2-4678-9e4c-aeaf14c56aca","Name":"accounts","ParentID":"root"} pkg=rhttp service=storage traceid=a05d4064c45adf0501fc17224928ef23
2020-10-06T21:43:37+02:00 DBG NodeFromPath() walk node={"Exists":false,"ID":"","Name":"4c510ada-c86b-4815-8820-42cdf82c3d51","ParentID":"69afd7ba-55f2-4678-9e4c-aeaf14c56aca"} pkg=rhttp service=storage traceid=a05d4064c45adf0501fc17224928ef23
2020-10-06T21:43:37+02:00 ERR error uploading file error="error: permission denied: 69afd7ba-55f2-4678-9e4c-aeaf14c56aca/4c510ada-c86b-4815-8820-42cdf82c3d51" pkg=rhttp service=storage traceid=a05d4064c45adf0501fc17224928ef23

@@ -206,12 +206,11 @@ func (r CS3Repo) DeleteGroup(ctx context.Context, id string) (err error) {

func (r CS3Repo) authenticate(ctx context.Context) (token string, err error) {
u := &user.User{
Id: &user.UserId{},
Id: &user.UserId{
OpaqueId: r.cfg.ServiceUser.UUID,
Copy link
Member Author

@butonic butonic Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kulmann we can always set the uuid ... if it is "" that is the same as this if magic ;-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not empty by default. It has a default UUID value in the flatset, so that it just works as soon as the username is provided. You're right, but it needs more change than this. ;-) Clear the default value for the UUID in the flagset and replace the checks on the username flag with checks on the uuid flag.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it has a uuid, but before this change it would only set it if the username was also set ... but it is empty by default: https://github.com/owncloud/ocis/pull/657/files#diff-69d2327c70e84f0e2b037204de3ef8e3L212-L214

// Protocol can be grpc or http
Protocol string
// URL is used by the gateway and registries (eg http://localhost:9100 or https://cloud.example.com)
URL string
// Endpoint is used by the gateway and registries (eg localhost:9100 or cloud.example.com)
Copy link
Member Author

@butonic butonic Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the best I could come up with to distinguish addr, host, port and url ... an endpoint is a combination of a tcp host and a port ... try googling for it. the only two URLs are the public facing endpoints, which is why the are now called PublicURL

@@ -42,7 +42,7 @@ func FrontendWithConfig(cfg *config.Config) []cli.Flag {
// this can eg. be set to /eos/users
&cli.StringFlag{
Name: "dav-files-namespace",
Value: "/oc/",
Value: "/users/",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we no longer need to change this from /oc to eos because we onlyd change the driver of the users storage provider mounted at /users

@@ -73,7 +88,15 @@ func StorageMetadata(cfg *config.Config) []cli.Flag {
flags = append(flags, DriverLocalWithConfig(cfg)...)
flags = append(flags, DriverOwnCloudWithConfig(cfg)...)
flags = append(flags, DriverOCISWithConfig(cfg)...)

flags = append(flags,
Copy link
Member Author

@butonic butonic Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@IljaN we need to append the storage-root to the end, otherwise the evaluation of the config flags for the drivers will overwrite the default that was written into &cfg.Reva.Storages.Common.Root.

},

&cli.StringFlag{
Name: "mount-path",
Value: "/public/",
Value: "/public",
Copy link
Member Author

@butonic butonic Oct 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@refs double check if public links work. I also updated the registry to use a path without slash, like the other mountpoints: https://github.com/owncloud/ocis/pull/657/files?file-filters%5B%5D=.go#diff-76cf344e66e9654cf08805e489b5d6c2R230

@@ -20,55 +20,48 @@ func UsersWithConfig(cfg *config.Config) []cli.Flag {

// Services

// Users
// Userprovider
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I renamed the STORAGE_USERS prefix for the userprovider service to STORAGE_USERPROVIDER, this way I could use STORAGE_USERS for the storage provider mounted at /users

@C0rby
Copy link
Contributor

C0rby commented Oct 7, 2020

Oh I can push changes to butonic:rename-storage. That's nice.

@C0rby
Copy link
Contributor

C0rby commented Oct 8, 2020

After renaming the environment variables the eos setup worked.
I'm not sure what I need to do for the ldap setup..

Name: "data-server-url",
Value: "http://localhost:9164/data",
Usage: "data server url",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_SERVER_URL"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used in drone

'STORAGE_STORAGE_OC_DATA_SERVER_URL': 'http://ocis-server:9164/data',

not needed anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the storages got streamlined so there is no OC storage anymore.

Name: "temp-folder",
Value: "/var/tmp/",
Usage: "temp folder",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_TEMP_FOLDER"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used in drone

'STORAGE_STORAGE_OC_DATA_TEMP_FOLDER': '/srv/app/tmp/',

not needed anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the storages got streamlined so there is no OC storage anymore.

Name: "temp-folder",
Value: "/var/tmp/",
Usage: "temp folder",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_TEMP_FOLDER"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used in drone

'STORAGE_STORAGE_HOME_DATA_TEMP_FOLDER': '/srv/app/tmp/',

not needed anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this configuration option does not exist anymore.

Name: "driver",
Value: "owncloud",
Usage: "storage driver for oc mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_OC_DRIVER"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used in drone

'STORAGE_STORAGE_OC_DRIVER': '%s' % (storage),

not needed anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the storages got streamlined so there is no OC storage anymore.

Name: "driver",
Value: "owncloud",
Usage: "storage driver for oc data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_OC_DATA_DRIVER"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used in drone

'STORAGE_STORAGE_OC_DATA_DRIVER': '%s' % (storage),

not needed anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the storages got streamlined so there is no OC storage anymore.

Name: "driver",
Value: "owncloud",
Usage: "storage driver for home data mount: eg. local, eos, owncloud, ocis or s3",
EnvVars: []string{"STORAGE_STORAGE_HOME_DATA_DRIVER"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

used in drone

'STORAGE_STORAGE_HOME_DATA_DRIVER': '%s' % (storage),

not needed anymore?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This option does not exist anymore.

David Christofas added 13 commits October 21, 2020 10:15
I currently don't know why but locally before renaming the service would always shutdown prematurely

Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
…id mapping

Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
Signed-off-by: David Christofas <dchristofas@owncloud.com>
@C0rby C0rby force-pushed the rename-storages branch 2 times, most recently from 5fe9109 to 3c28fda Compare October 21, 2020 09:30
@C0rby
Copy link
Contributor

C0rby commented Oct 21, 2020

Oh ffs... now apiWebdavEtagPropagation1/moveFileFolder.feature:20 is switching between passing and failing...

Signed-off-by: David Christofas <dchristofas@owncloud.com>
@C0rby
Copy link
Contributor

C0rby commented Oct 21, 2020

Oh I hope it'll work.

@sonarcloud
Copy link

sonarcloud bot commented Oct 21, 2020

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@butonic butonic changed the title [WIP] update reva and refactor config update reva and refactor config Oct 21, 2020
@C0rby C0rby merged commit 8aec764 into owncloud:master Oct 21, 2020
@kulmann
Copy link
Member

kulmann commented Oct 21, 2020

🥳

@butonic butonic deleted the rename-storages branch October 21, 2020 15:33
ownclouders pushed a commit that referenced this pull request Oct 21, 2020
Merge: d9d7272 8445996
Author: David Christofas <C0rby@users.noreply.github.com>
Date:   Wed Oct 21 17:22:15 2020 +0200

    Merge pull request #657 from butonic/rename-storages

    update reva and refactor config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants